﻿<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:ValueConverters="clr-namespace:Alfa.Common.ValueConverters;assembly=Alfa.Common"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
		<ValueConverters:BooleanNegationConverter x:Key="BooleanNegationConverter" />
		<ValueConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
		<ValueConverters:DateTimeToStringConverter x:Key="DateTimeToStringConverter" />
		<ValueConverters:DecimalToStringConverter x:Key="DecimalToStringConverter" />
		<ValueConverters:StringToDateTimeConverter x:Key="StringToDateTimeConverter" />
		<ValueConverters:StringToDecimalConverter x:Key="StringToDecimalConverter" />
		<ValueConverters:StringToImageSourceConverter x:Key="StringToImageSourceConverter" />
		<ValueConverters:StringToTimeSpanConverter x:Key="StringToTimeSpanConverter" />
		<ValueConverters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
		<ValueConverters:TimeSpanToDateTimeConverter x:Key="TimeSpanToDateTimeConverter" />
		<ValueConverters:TimeSpanToStringConverter x:Key="TimeSpanToStringConverter" />

		<Style x:Key="FrameworkElementInError" TargetType="{x:Type FrameworkElement}">
			<Style.Triggers>
				<Trigger Property="Validation.HasError" Value="true">
					<Setter Property="ToolTip" Value="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={x:Static RelativeSource.Self}}"/>
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="errorTextBlock" TargetType="{x:Type TextBlock}">
			<Setter Property="Foreground" Value="Red" />
			<Setter Property="Margin" Value="5,0,5,5" />
			<Setter Property="TextWrapping" Value="Wrap" />
			<Setter Property="Visibility" Value="{Binding Text, Converter={StaticResource StringToVisibilityConverter}, RelativeSource={x:Static RelativeSource.Self}}" />
		</Style>
	</Application.Resources>
</Application>
